package neuron;

import function.Function;

public class Neuron implements Runnable
{
	Function function;
	private double[] weights;
	private double[] input;
	private double output = 0;

	public Neuron(double[] weights, Function function)
	{
		this.weights = weights;
		this.function = function;
	}

	@Override
	public void run()
	{
		for(int i = 0; i < input.length; ++i)
		{
			output += input[i] * weights[i];
		}

		output = function.f(output);
	}

	public void setInput(double[] input)
	{
		this.input = input;
	}

	public double getOutput()
	{
		return output;
	}

	public double[] getWeights()
	{
		return weights;
	}
}
